﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.ComponentModel;

namespace CoiffeurProject.Utils
{
    public static class Extensions
    {
        public static void DisableForegroundWindow(this Window owner, Window child)
        {
            owner.IsEnabled = false;
            child.Closing += new System.ComponentModel
                .CancelEventHandler(delegate(object s, CancelEventArgs e) {
                    owner.IsEnabled = true;
                });
        }

        public static string ToCustomString(this DateTime dateTime)
        {
            string separator = "-";
            return dateTime.Year + separator + dateTime.Month + separator + dateTime.Day;
        }

        public static string MonthToString(this DateTime dateTime)
        {
            int month = dateTime.Month;

            switch (month)
            { 
                case 1:
                    return "Gennaio";
                case 2:
                    return "Febbraio";
                case 3:
                    return "Marzo";
                case 4:
                    return "Aprile";
                case 5:
                    return "Maggio";
                case 6:
                    return "Giugno";
                case 7:
                    return "Luglio";
                case 8:
                    return "Agosto";
                case 9:
                    return "Settembre";
                case 10:
                    return "Ottobre";
                case 11:
                    return "Novembre";
                default:
                    return "Dicembre";
            }
        }

        public static string DayToString(this DateTime dateTime)
        {
            DayOfWeek day = dateTime.DayOfWeek;

            switch (day)
            {
                case DayOfWeek.Monday:
                    return "Lunedì";
                case DayOfWeek.Tuesday:
                    return "Martedì";
                case DayOfWeek.Wednesday:
                    return "Mercoledì";
                case DayOfWeek.Thursday:
                    return "Giovedì";
                case DayOfWeek.Friday:
                    return "Venerdì";
                case DayOfWeek.Saturday:
                    return "Sabato";
                default:
                    return "Domenica";
            }
        }
    }
}
